<?php
/**
 * Created by PhpStorm.
 * User: fengsenhua
 * Date: 2019/1/30
 * Time: 14:57
 */

namespace app\api\controller\v1;

use app\api\validate\IDMustBePostiveInt;
use app\api\model\Banner as BannerModel;
use app\lib\exception\BannerMissException;
use think\Exception;

class Banner
{

    /**
     * 获取图片轮播图的Banner_id方法
     *
     * @url/banner/:id
     * @http GET类型
     * @id banner的id号
     * @return
    */
public function getBanner($id){
        //AOP面向切面教程
    (new IDMustBePostiveInt())->goCheck();
    $banner = BannerModel::getBannerByID($id);
    if (!$banner) {
        throw new BannerMissException();
     }
     $c=config('setting.img_prefix');
    return $banner;
    }
}